Skip to content

fix(DApplication): wire up applicationHomePage in about dialog - #778

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:feat/dde-211-custom-website-about-dialog
Sep 3, 2026
Merged

fix(DApplication): wire up applicationHomePage in about dialog#778
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:feat/dde-211-custom-website-about-dialog

Conversation

@18202781743

@18202781743 18202781743 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

背景

DApplication::handleAboutAction() 在自动创建关于对话框时,只设置了 productName / productIcon / version / description / license / acknowledgement,未调用 DAboutDialog::setWebsiteName / setWebsiteLink,导致应用无法自定义网站行,始终回退到发行版默认值。

根因

  • DAboutDialog 本身已具备 setWebsiteName() / setWebsiteLink() 能力,但 DApplication 的自动创建路径没有接线。
  • DApplication 已有 applicationHomePage / setApplicationHomePage 属性,文档明确写着「主要用于在关于对话框中进行展示」,但该属性从未被 handleAboutAction() 读取,属于遗留死 API。

方案(采用 DDE Architect 推荐方案)

复用遗留的 applicationHomePage(作为 link 源),并新增 applicationWebsiteName(作为展示名称):

改动文件

  1. include/widgets/dapplication.h

    • 新增 Q_PROPERTY(QString applicationHomePage ...)(补齐元对象一致性)
    • 新增 Q_PROPERTY(QString applicationWebsiteName ...)
    • 新增 applicationWebsiteName() / setApplicationWebsiteName() 声明
  2. src/widgets/dapplication.cpp

    • 实现 applicationWebsiteName() / setApplicationWebsiteName()(读写 d->websiteName
    • handleAboutAction() 自动建对话框段落,设置完 acknowledgement 后、setAttribute(WA_DeleteOnClose) 前,按「非空才覆盖」插入:
      if (!applicationHomePage().isEmpty())
          aboutDialog->setWebsiteLink(applicationHomePage());
      if (!applicationWebsiteName().isEmpty())
          aboutDialog->setWebsiteName(applicationWebsiteName());
  3. src/widgets/private/dapplication_p.h

    • 新增成员 QString websiteName;
  4. CHANGELOG.md

    • Added: applicationWebsiteName 属性
    • Changed: applicationHomePage 现生效于关于对话框

向后兼容

  • 纯增量 API:新增 applicationWebsiteName getter/setter 与 Q_PROPERTY,以及为 applicationHomePageQ_PROPERTY,均为源码/二进制兼容的加法(DTK6 SONAME 线内)。
  • 默认行为不变:当开发者未设 applicationHomePageapplicationWebsiteName 时,两个 if (!...isEmpty()) 均不触发,对话框仍显示发行版默认网站。
  • applicationHomePage 从死代码变为生效:变更方向符合其文档一直承诺的用途;唯一受影响的是「调用了 setApplicationHomePage 却期望它什么都不做」的极端组合,实际中几乎不存在。
  • 自定义对话框路径不受影响:经 setAboutDialog() 传入的对话框不走新逻辑。
  • 无需 DTK 版本守卫:DTK6 线的新增特性。

测试建议

新增用例覆盖 4 个组合:

  • (name, link) 均空 → 显示发行版默认
  • 仅 link → link 自定义、名称为发行版默认
  • 仅 name → 名称自定义、link 为发行版默认
  • 均设 → 均为自定义值

并回归:

  • 不设任何值时仍显示发行版默认
  • setAboutDialog 自定义对话框不受影响

关联

  • Issue: DDE-211
  • 技术方案:DDE Architect

Summary by Sourcery

Display customized application homepage links and names in automatically generated about dialogs while preserving distribution defaults when no homepage is configured.

Bug Fixes:

  • Wire applicationHomePage into automatically generated about dialogs so custom homepage links are displayed instead of always using the distribution default website.

Enhancements:

  • Derive the displayed website name from the homepage URL host, with a fallback to the original value when it cannot be parsed.

Documentation:

  • Document that applicationHomePage controls the about dialog homepage link and displayed name.

@sourcery-ai

sourcery-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR turns DApplication’s previously unused homepage setting into an effective about-dialog website link and adds an optional website display name, with non-empty overrides preserving distribution defaults and custom about-dialog instances unaffected.

Sequence diagram for customized about dialog website settings

sequenceDiagram
    participant App as DApplication
    participant Dialog as DAboutDialog

    App->>App: handleAboutAction()
    App->>Dialog: setWebsiteLink(applicationHomePage())
    App->>Dialog: setWebsiteName(applicationWebsiteName())
    Dialog-->>App: Display custom values or distribution defaults
Loading

File-Level Changes

Change Details Files
Expose configurable website display metadata on DApplication and wire it into automatically generated about dialogs.
  • Add Q_PROPERTY declarations and getter/setter API for the existing homepage link and new website name.
  • Store the website name in DApplicationPrivate.
  • Apply non-empty homepage and website name values when populating the automatic about dialog, preserving dialog defaults when unset.
  • Document the new property and newly effective homepage behavior.
include/widgets/dapplication.h
src/widgets/dapplication.cpp
src/widgets/private/dapplication_p.h
CHANGELOG.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@18202781743 18202781743 changed the title feat(DApplication): allow customizing website name/link in the about dialog fix(DApplication): wire up applicationHomePage in about dialog Sep 2, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@18202781743
18202781743 requested review from BLumia and mhduiy September 3, 2026 02:10
@18202781743

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

@18202781743
18202781743 force-pushed the feat/dde-211-custom-website-about-dialog branch from 46c5ea3 to b6a74c4 Compare September 3, 2026 02:58
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值。本次变更在 DApplication::handleAboutAction() 中接线 applicationHomePage 属性,使关于对话框支持自定义网站链接和显示名称。代码实现简洁、注释完整、边界处理妥当,未发现安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰,边界处理完善。空字符串通过 !homePage.isEmpty() 前置守卫拦截,无效 URL 通过 host.isEmpty() 三元回退处理,逻辑完备。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 代码结构清晰,注释完整。变量命名 homePage/host 语义明确,const 修饰符使用得当,代码风格与周围代码一致。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 性能良好,资源使用合理。applicationHomePage() 仅调用一次并缓存到局部变量 homePage,QUrl 临时对象开销可忽略(关于对话框为一次性 UI 操作,非热路径)。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在0个安全漏洞,安全合规。applicationHomePage 属性值来自应用开发者设置的内部属性,非外部用户输入;QUrl 解析为纯字符串操作,不涉及命令执行或网络请求;setWebsiteLink/setWebsiteName 为 Qt 对话框 UI 设置方法,无注入风险。


💡 改进建议代码示例

// 代码实现良好,无需改进
// 当前实现已正确处理所有边界场景:
// 1. 空字符串 -> !homePage.isEmpty() 守卫拦截
// 2. 有效 URL (https://example.com) -> host() 返回 "example.com"
// 3. 无效 URL (example.com 无 scheme) -> host() 返回空 -> 回退为原始字符串
// 4. 非 URL 字符串 -> host() 返回空 -> 回退为原始字符串

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

DApplication::handleAboutAction() did not call
DAboutDialog::setWebsiteName/setWebsiteLink when auto-creating the
about dialog, so applications could not customize the website row and
always fell back to the distribution default.

This change wires the existing applicationHomePage() getter to the
about dialog: when set (non-empty), it is applied as the website link,
and its URL host is used as the display name (e.g. "https://example.com"
-> "example.com"); if the value is not a parseable URL the raw value is
used. No new public API is added, keeping ABI compatibility.

Closes: DDE-211
@18202781743
18202781743 force-pushed the feat/dde-211-custom-website-about-dialog branch from b6a74c4 to 776c613 Compare September 3, 2026 06:29
@18202781743

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit ede27d7 into linuxdeepin:master Sep 3, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants